//
//  FSDetailCell.m
//  Trade
//
//  Created by 刘沿 on 16/4/7.
//  Copyright © 2016年 刘沿. All rights reserved.
//

#import "FSDetailCell.h"

@implementation FSDetailCell


+(instancetype)cellWihtTableView:(UITableView*)tableView{
    NSString * cellIdentifier = @"cellIdentifier";
    FSDetailCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"FSDetailCell" owner:nil options:nil] lastObject];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    
    return cell;
    
}

-(void)setIndexPath:(NSIndexPath *)indexPath{
    _indexPath = indexPath;
    if (indexPath.section == 0) {
        switch (indexPath.row) {
            case 0:
                self.titleLabel.text = @"来文单位:";
                self.descLabel.text =self.detailModel.source;
                //self.textField.text = self.detailModel.source;
                break;
            case 1:
                self.titleLabel.text = @"收文类型:";
                self.descLabel.text =self.detailModel.fileType;
                // self.textField.text = self.detailModel.fileType;
                break;
            case 2:
                self.titleLabel.text = @"来文编号:";
                self.descLabel.text =self.detailModel.number;
                // self.textField.text = self.detailModel.number;
                break;
            case 3:
                self.backgroundColor = [UIColor redColor];

                self.titleLabel.text = @"收文分类:";
                self.descLabel.text = self.detailModel.receivedSort;
                // self.textField.text = self.detailModel.receivedSort;
                break;
            case 4:
                self.titleLabel.text = @"文件标题:";
                self.descLabel.text = self.detailModel.title;
                //  self.textField.text = self.detailModel.title;
                break;
            case 5:
                self.titleLabel.text = @"紧急程度:";
                self.descLabel.text =  self.detailModel.urgency;
                //  self.textField.text = self.detailModel.urgency;
                break;
            case 6:
                self.titleLabel.text = @"公开:";
                self.descLabel.text = self.detailModel.publices;
                // self.textField.text = self.detailModel.publices;
                break;
            case 7:
                self.titleLabel.text = @"收文份数:";
                if ([self.detailModel.count isEqualToString:@"null"]) {
                    self.detailModel.count = @"";
                }
                self.descLabel.text = self.detailModel.count;
                // self.textField.text = self.detailModel.count;
                break;
            case 8:
                self.titleLabel.text = @"登记人:";
                self.descLabel.text =  self.detailModel.booker;
                // self.textField.text = self.detailModel.booker;
                break;
            case 9:
                self.titleLabel.text = @"收文日期:";
                self.descLabel.text = self.detailModel.receiveDate;
                //  self.textField.text = self.detailModel.receiveDate;
                break;
            case 10:
                self.titleLabel.text = @"备注:";
                self.descLabel.text = self.detailModel.remarks;
                // self.textField.text = self.detailModel.remarks;
                break;
            case 11:
                self.titleLabel.text = @"拟办意见:";
                self.descLabel.text = self.detailModel.officeDone;
                // self.textField.text = self.detailModel.officeDone;
                break;
            case 12:
                self.titleLabel.text = @"办理情况:";
                self.descLabel.text = self.detailModel.condition;
                // self.textField.text = self.detailModel.condition;
                break;
            case 13:
                self.titleLabel.text = @"领导批示:";
                self.descLabel.text = self.detailModel.leaderScan;
                //  self.textField.text = self.detailModel.leaderScan;
                break;
            case 14:
                self.titleLabel.text = @"部门意见:";
                self.descLabel.text = self.detailModel.sugest;
                // self.textField.text = self.detailModel.sugest;
                break;
            default:
                self.titleLabel.text = @"";
                self.descLabel.text =@"";
                //self.textField.text = @"";
                break;
        }
        
    }else if (indexPath.section == 1){
        self.titleLabel.text = @"";
        self.descLabel.text =@"";
        
    }else if (indexPath.section == 2){
        self.titleLabel.text = @"";
        self.descLabel.text =@"";
    }
    
}

-(void)editStatus:(BOOL)editor{ //编辑;
    if (editor) {
        if ([[NSString stringWithFormat:@"%@:",self.detailModel.setp] isEqualToString:self.titleLabel.text]) {
            self.textField.hidden = NO;
            self.descLabel.hidden = NO;
        }else{
            self.textField.hidden = YES;
            self.descLabel.hidden = NO;
        }
    }else{
        self.textField.hidden = YES;
        self.descLabel.hidden = NO;
    }
    
}



@end
